<?
    $subnav_arr = array();
    foreach ($subnav as $row0) {
        $subnav_arr[]= $row0->mainnav_id;
    }
?>
<div id="myslidemenu" class="jqueryslidemenu">
    <div class="m_home left">
        <a href="<?=base_url()?>"><img src="<?=base_url()?>assets/img/mmenu/home.gif" alt="" /></a>
    </div>
    <ul class="left">
        <?
            $i=1;
            foreach ($mainnav as $row)
            {
            ?>
            <li>
                <a <? if($i!=3){?> href="<?=base_url()?><?=$row->menuid;?>" <?}?> class="<?=$lang.'_';?>mmenu<?=$i?>" id="<?=$row->menuid;?>">
                    <span class="navhover"></span>
                    <span class="navnormal"><?=$row->title;?></span>
                </a><?
                    if (in_array($row->id, $subnav_arr)) {?>
                    <ul>
                        <?
                            foreach ($subnav as $row2) {
                                if($row->id==$row2->mainnav_id){?>
                                <li><a href="<?=base_url()?>tours/<?=$row2->link;?>"><?=$row2->title;?></a></li>
                                <?}
                            }
                        ?>
                    </ul>
                    <?}?>
            </li>
            <? 
            if($i!=9){ 
            ?> <li class="space"></li> <? 
            }
            $i++;
            }
        ?>

    </ul>
</div>